package com.example.springboot.mapper;

import com.example.springboot.entity.SelfServiceOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SelfServiceOrderMapper {
    List<SelfServiceOrder> findAll(
            @Param("offset") int offset,
            @Param("size") int size,
            @Param("status") String status,
            @Param("orderType") String orderType
    );

    List<SelfServiceOrder> findByAdminId(
            @Param("offset") int offset,
            @Param("size") int size,
            @Param("adminId") int adminId,
            @Param("status") String status,
            @Param("orderType") String orderType
    );

    int getTotalOrders(
            @Param("status") String status,
            @Param("orderType") String orderType
    );

    int getTotalOrdersByAdminId(
            @Param("adminId") int adminId,
            @Param("status") String status,
            @Param("orderType") String orderType
    );

    SelfServiceOrder findById(Integer orderId);

    void deleteById(Integer orderId);

    Integer findAdminIdByUsername(String username);

    String findAdminRoleByUsername(String username);

    boolean isOrderManagedByAdmin(@Param("orderId") Integer orderId, @Param("adminId") Integer adminId);
}